package com.xuecheng.search.controller;


import com.xuecheng.api.search.CoursePubSearchApi;
import com.xuecheng.api.search.model.dto.CoursePubIndexDTO;
import com.xuecheng.api.search.model.qo.QueryCoursePubIndexModel;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.common.domain.response.RestResponse;
import com.xuecheng.search.service.CoursePubSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
public class CoursePubIndexController implements CoursePubSearchApi {

    @Autowired
    private CoursePubSearchService coursePubSearchService;

    @PostMapping("course_index")
    public PageVO<CoursePubIndexDTO> queryCoursePubIndexList(PageRequestParams params, @RequestBody QueryCoursePubIndexModel model) {

        return coursePubSearchService.queryCoursePubIndexList(params, model);
    }

    @GetMapping("course_index/{coursePubId}")
    public CoursePubIndexDTO getCoursePubIndexById(@PathVariable Long coursePubId) {

        return coursePubSearchService.getCoursePubIndexById(coursePubId);
    }

    @GetMapping("l/course-index/{coursePubId}")
    public RestResponse<CoursePubIndexDTO> getCoursePubIndexById4s(@PathVariable Long coursePubId) {

        return coursePubSearchService.getCoursePubIndexById4s(coursePubId);
    }
}
